package com.atguigu.gmall.cart.client;

import com.atguigu.gmall.cart.client.impl.CartFeignClientImpl;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.cart.CartInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;


@FeignClient(value = "service-cart",fallback = CartFeignClientImpl.class)
public interface CartFeignClient {
    @PostMapping("/api/cart/addToCart/{skuId}/{skuNum}")
    Result addToCart(@PathVariable("skuId") Long skuId,
                            @PathVariable("skuNum") Integer skuNum);

    @DeleteMapping("/api/cart/deleteCart/{skuId}")
    Result<Void> deleteCart(@PathVariable("skuId") String skuId);

    @GetMapping("/api/cart/auth/get/checked/cart")
    public Result<List<CartInfo>> getCheckedCart();

}
